﻿using Knlght.Model.Sys;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Knlght.Mappings
{
    public class SysSettingMapping : EntityTypeConfiguration<Setting>
    {
        public SysSettingMapping()
        {
            // 设置表名
            this.ToTable("Sys" + nameof(Setting));
            //设置主键
            this.HasKey(a => a.Key);
            //不自增
            this.Property(t => t.Key).HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);
            //不更新
            //this.Property(t => t.UpdateTime).HasDatabaseGeneratedOption(DatabaseGeneratedOption.Computed);
            // 设置属性的类型和长度
            this.Property(a => a.Key).HasColumnType("NVarchar").HasMaxLength(200);            
        }
    }
}
